package com.tfswx.jcyw.ruleenginedesigner.api;

import com.tfswx.jcyw.ruleenginedesigner.bean.ApiResult;
import com.tfswx.jcyw.ruleenginedesigner.dto.sjk.DataQueryInputDTO;
import com.tfswx.jcyw.ruleenginedesigner.service.SjkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author Ricky
 * @date 2021/6/16
 */
@RestController
@RequestMapping("/sjk")
@Api(tags = "数据库")
public class SjkController {

    @Resource
    private SjkService sjkService;

    @ApiOperation("查询数据")
    @PostMapping("/queryData")
    public ApiResult<List<Map<String, Object>>> queryData(@RequestBody @Validated DataQueryInputDTO dataQueryInputDTO) throws ClassNotFoundException {
        List<Map<String, Object>> data = sjkService.queryData(dataQueryInputDTO);
        return ApiResult.success(data);
    }
}
